{% extends "base.html" %}
{% block title %}Home{% endblock title %}
{% block head %}<script src="/js/common.js"></script>
<script src="/js/tweet.js"></script>
{% if token_user.geo_enabled %}<script src="/js/geo.js"></script>{% endif %}
<script type="text/javascript">
$(function(){
	//more
	var m = more('/x/home/more', {'max_id': {{ max_id|to_json }} } );
	$('#pagination .more').live('click', function(e){
		m.next();
		e.preventDefault();return false;
	});
	var max_more=5, preload=50+50;
	$(window).bind('scroll',function(){
		if( m.count<max_more && ($('body').height()-preload) < ($(window).height()+$(window).scrollTop()) ){
			m.next();
		}
	});
	
	//refresh
	var ref=refresh('/x/home/refresh', {'since_id':{{ since_id|to_json }} });
	ref.start();
	$('#Notifier').click(function(e){
		ref.show();
		e.preventDefault();return false;
	});
});
</script>
{% if owner_user %}{% include "user-style.html" %}{% endif %}
{% endblock head %}
{% block main %}
{% include "tweet-form.html" %}
{% include "main-nav.html" %}
<div id="Timeline">
	<div id="Tlheading">Home</div>
	<div id="Notifier"></div>
	<ul class="tweets">
	{% if timeline %}
	{% for tweet in timeline %}
		{% include "tweet.html" %}
	{% endfor %}
	{% else %}
		<li class="nothing">No tweets here.</li>
	{% endif %}
	</ul>
	{% if max_id %}<div id="pagination"><img class="loading" src="/images/loading.gif" /><a class="more" href="{{ self.current }}?max_id={{ max_id }}">More</a></div>{% endif %}
</div>
{% endblock main%}

{% block side %}
{% include "side.html" %}
{% endblock side %}